package com.by.component.export.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum ExportTypeEnum {

    PROMOTION_SUB_PLAN(ExportTypeEnum.PROMOTION_SUB_PLAN_CODE, "推广子计划", true),
    INVESTMENT_WORKBENCH(ExportTypeEnum.INVESTMENT_WORKBENCH_CODE, "代投流服务工作台", false),
    CLUE_WORKBENCH(ExportTypeEnum.CLUE_WORKBENCH_CODE, "线索工作台", false),
    USER_WORKBENCH(ExportTypeEnum.USER_WORKBENCH_CODE, "用户工作台", false),
    WX_CP_CHAT_MSG(ExportTypeEnum.WX_CP_CHAT_MSG_CODE, "企业微信会话存档导出", false),
    CHANNEL_STATISTIC(ExportTypeEnum.CHANNEL_STATISTIC_CODE, "渠道数据统计", false),
    PHYSICAL_ORDER(ExportTypeEnum.PHYSICAL_ORDER_CODE, "实物订单", false),
    COURSE_WARE_LINK_WITH_INVITE(ExportTypeEnum.COURSE_WARE_LINK_WITH_INVITE_CODE, "带邀请码的课件链接", false),
    SALE_PERFORMANCE_PHYSICAL(ExportTypeEnum.SALE_PERFORMANCE_PHYSICAL_CODE, "销售业绩看板(实体类详情)", false),
    SETTLEMENT_RECORD(ExportTypeEnum.SETTLEMENT_RECORD_CODE, "核算记录", false),
    FINANCE_REFUND(ExportTypeEnum.FINANCE_REFUND_CODE, "财务退款列表", false),
    REFUND_FEEDBACK_TASK(ExportTypeEnum.REFUND_FEEDBACK_TASK_CODE, "退款回访任务", false),
    PERFORMANCE_LEARN_DATA_STATISTIC(ExportTypeEnum.PERFORMANCE_LEARN_DATA_STATISTIC_CODE, "业绩看板-学习数据统计", false),
    EXPORT_ABNORMAL_TRAFFIC_RECORD(ExportTypeEnum.EXPORT_ABNORMAL_TRAFFIC_RECORD_CODE, "异常流量数据", false),
    EXPORT_SALE_PERFORMANCE_DAY(ExportTypeEnum.EXPORT_SALE_PERFORMANCE_DAY_CODE, "业绩看板-单日数据", false),
    CHANNEL_STATISTIC_MARKET(ExportTypeEnum.CHANNEL_STATISTIC_MARKET_CODE, "渠道数据统计-市场", false),
    COURSE_CURRICULUM_WARE_REWARD_USER_RECORD(ExportTypeEnum.COURSE_CURRICULUM_WARE_REWARD_USER_RECORD_CODE, "课表-课件金额发放记录", false),

    ;

    private Integer code;
    private String desc;

    private boolean responseExport;

    private static final Map<Integer, ExportTypeEnum> MAP = Arrays.stream(ExportTypeEnum.values())
            .collect(Collectors.toMap(ExportTypeEnum::getCode, Function.identity()));

    public static ExportTypeEnum resolve(Integer code) {
        return MAP.get(code);
    }

    public static final int PROMOTION_SUB_PLAN_CODE = 1;
    public static final int INVESTMENT_WORKBENCH_CODE = 2;
    public static final int CLUE_WORKBENCH_CODE = 3;
    public static final int USER_WORKBENCH_CODE = 4;
    public static final int WX_CP_CHAT_MSG_CODE = 5;
    public static final int CHANNEL_STATISTIC_CODE = 6;
    public static final int PHYSICAL_ORDER_CODE = 7;
    public static final int COURSE_WARE_LINK_WITH_INVITE_CODE = 8;
    public static final int SALE_PERFORMANCE_PHYSICAL_CODE = 9;
    public static final int SETTLEMENT_RECORD_CODE = 10;
    public static final int FINANCE_REFUND_CODE = 11;
    public static final int REFUND_FEEDBACK_TASK_CODE = 12;
    public static final int PERFORMANCE_LEARN_DATA_STATISTIC_CODE = 13;
    public static final int EXPORT_ABNORMAL_TRAFFIC_RECORD_CODE = 14;
    public static final int EXPORT_SALE_PERFORMANCE_DAY_CODE = 15;
    public static final int CHANNEL_STATISTIC_MARKET_CODE = 16;
    public static final int COURSE_CURRICULUM_WARE_REWARD_USER_RECORD_CODE = 17;

}
